<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%
String path = request.getContextPath()+"";
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>上海斡创后台管理系统V2.0</title>
<link rel='icon' href='<%=path %>/admin-favicon.ico' type=‘image/x-ico’ />
<script type="text/javascript" src="<%=path %>/common/back/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=path %>/resources/js/DD_belatedPNG.js"></script>
<script src="${path }/common/back/js/util.js" type="text/javascript"></script>

<script>
DD_belatedPNG.fix('.container,.sub,background');
</script>

<style type="text/css">
body {
	margin: 0;
	padding: 0;
	font-size: 12px;
<%-- 	background:#0f579f url(<%=path %>/common/back/images/bg.jpg) top center no-repeat; --%>
	color:#fff;
}

.input {
	width:270px;
	height:32px;
	line-height:32px;
	border:1px solid #cbd4e2;
	margin-left:5px;
	margin-top:5px;
	text-indent:12px;
/* 	border-top: 1px solid #404040; */
/* 	border-left: 1px solid #404040; */
/* 	border-right: 1px solid #D4D0C8; */
/* 	border-bottom: 1px solid #D4D0C8; */
}
</style>
</head>
<body>
<div class="container">
	<form id="jvForm" name="jvForm" action="login" method="post" onsubmit="return login();">
		<table width="750" border="0" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="200">&nbsp;</td>
			</tr>
			<tr>
				<td><table width="325" border="0" cellspacing="0"
						cellpadding="10">
						<tr>
							<td><table
									width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td style="height:280px;"><img src="<%=path %>/common/back/images/llogo.png" /></td>
									</tr>
								</table></td>
							<td></td>
							<td>
							<table width="100%" border="0" cellspacing="0" cellpadding="0" style="box-shadow: 0 0 10px #ccc">
									<tr>
										<td height="80" align="center" style="color:#354053;font-size:28px" > 后台管理登录 </td>
									</tr>
									<tr>
										<td>
											
											<table width="100%" border="0" align="center" cellpadding="0"
												cellspacing="5">
												<tr>
<!-- 													<td width="91" height="40" align="right"><strong>手机号码：</strong></td> -->
													<td><input type="text" placeholder="请输入手机号码"  id="userMobile" name="userMobile"  maxlength="100" class="input" />
													</td>
												</tr>
												<tr>
<!-- 													<td height="40" align="right"><strong>密&nbsp;&nbsp;码：</strong></td> -->
													<td><input name="userPassword" type="password" placeholder="请输入密码" id="userPassword" maxlength="32"  class="input" /></td>
												</tr>
												<tr>
<!-- 													<td height="40" align="right"><strong>验证码：</strong></td> -->
													
													<td>
													<input maxlength="4" style="width:190px;float:left;" placeholder="请输入验证码" name="captcha" type="text" id="captcha" class="input"  />
													<img id="imgCap" style=" width:78px;height:34px;margin-top:5px;float:left;border:1px solid #cbd4e2;border-left:none" src="<%=path %>/captcha.svl" onclick="this.src='<%=request.getContextPath() %>/captcha.svl?d='+new Date()*1" valign="bottom" alt="点击更新" title="点击更新" />
													<%-- <span style="width:100px; color:red; display:none;">${msg}</span> --%>
													</td>
												</tr>
												<tr>
<!-- 													<td height="40" align="right"><strong>短信验证码：</strong></td> -->
													<td>
														<input name="smsCode" type="text" id="smsCode" maxlength="32" placeholder="请输入短信验证码"  class="input" style="width:190px;float:left;" />
														<a href="javascript:;" id="sendCode" onclick="sendCode();" 
														style="display:inline-block; background: #fff;	margin-top:5px; color: #2a85f7;line-height:34px;text-decoration:none;
                                                         width:78px; font-size: 12px;height:34px;float:left;border:1px solid #cbd4e2;border-left:none;text-align: center;" >
														获取验证码</a>
													</td>
												</tr>
												<tr>
													<td colspan="2" align="center" class="sub">
													<input type="image" src="<%=path %>/common/back/images/login.png"  name="submit"  style="width:270px;height:45px;margin-top:30px;background:#2a85f7;color:#fff;
													font-size:18px;margin-left:5px;border-style:none;border-radius:2px" value="登录" />&nbsp; &nbsp;&nbsp;</td>
												</tr>
											</table>
										</td>
									</tr>
								</table></td>
						</tr>
					</table></td>
			</tr>
		</table>
	</form>
</div>
</body>
<script>
var wait = 60;
function time(htmlId, click) {
	if (wait == 0) {
		$("#" + htmlId).attr("onclick", click);
		$("#" + htmlId).text("获取验证码");
		wait = 60;
	} else {
		$("#" + htmlId).text(wait + "秒后重试");
		$("#" + htmlId).removeAttr("onclick");
		wait--;
		setTimeout(function() {
			time(htmlId, click);
		}, 1000);
	}
}
	function sendCode() {
		 if (jvForm.userMobile.value==""){
	        alert("手机号码不能为空！");
	        return false;
	    }else if (jvForm.userPassword.value==""){
	        alert("密码不能为空！");
	        return false;
	    }else if (jvForm.captcha.value==""){
	        alert("验证码不能为空！");
	        return false;
	    }else{
			 $.ajax({
				type : "post",
				data:{
					"userMobile":$("[name='userMobile']").val(),
					"userPassword":$("[name='userPassword']").val(),
					"RCaptchaKey":$("[name='RCaptchaKey']").val(),
					"captcha":$("[name='captcha']").val()
				},			
				url : "sendSmsBack",
				success : function(ret) {
					if(ret.code == '200'){
						time('sendCode','sendCode()');
						alert(ret.msg);
					}else{
						$("#imgCap").trigger("click");
						alert(ret.msg);
					}
				},
				error:function(ret){
					$("#imgCap").trigger("click");
				}
			});
    	}
	}
function login(){
    if (jvForm.userMobile.value==""){
        alert("手机号码不能为空！");
        return false;
    }else if (jvForm.userPassword.value==""){
        alert("密码不能为空！");
        return false;
    }else if (jvForm.captcha.value==""){
        alert("验证码不能为空！");
        return false;
    }
	else if (jvForm.smsCode.value==""){
        alert("短信验证码不能为空！");
        return false;
    }
}
var msg="${message}";
if(msg){
	alert(msg);
}
</script>
</html>
